package tom.spring.cloud.amqp.rabbitmq.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * 监听hello queue的消息
 * @author ZHUFEIFEI
 */
@Slf4j
@Component
@RabbitListener(queues = "hello")
public class DirectListener {

    @RabbitHandler
    public void receive1(String msg) {
        log.info("receive1 msg : {}", msg);
    }

    @RabbitHandler
    public void receive2(Message msg) {
        log.info("receive2 msg : {}", msg);
    }
}
